package com.yue.controller;

import com.yue.pojo.Student;
import com.yue.pojo.User;
import com.yue.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpSession;

@Controller
@RequestMapping("/student")
public class StudentController {
    @Autowired
    private StudentService studentService;

    @RequestMapping("/getstuinfo")
     String gostuinfo(HttpSession session, Model model){
        User user = (User) session.getAttribute("user");
        Student student = studentService.getById(user.getStu_id());
        model.addAttribute("student",student);
        System.out.println(student);
        return "stuinfo";
    }
}
